<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="shortcut icon" href="../../../favicon.ico" type="image/x-icon">
	<title>non_controlled</title>
</head>
<body>
  <div id="test"></div>

  <script type="text/javascript" src="../../../js/react.development.js" ></script>
  <script type="text/javascript" src="../../../js/react-dom.development.js"></script>
  <script type="text/javascript" src="../../../js/babel.min.js"></script>
  <script type="text/javascript" src="../../../js/prop-types.js"></script>

  <script type="text/babel">
    // 非受控:现用现取
    class Login extends React.Component {

      onSubmit=(event)=>{
        event.preventDefault(); // 阻止表单提交
        const {username, password} = this
        console.log(username.value+":"+password.value)
      }

      render(){
        return (
          <form action="http://www.atguigu.com" onSubmit={this.onSubmit}>
            username: <input ref={c=>this.username=c} type="text" name="username" />
            password: <input ref={c=>this.password=c} type="password" name="password" />
            <button>login</button>
          </form>
        )
      }
    }

    ReactDOM.render(<Login />, document.getElementById('test'));
  </script>
</body>